home *** CD-ROM | disk | FTP | other *** search
/ Ray Dream Studio 5 / Ray Dream.iso / pc / DreamSDK / Windows / INCLUDES / I3DSHOBJ.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-11  |  15.9 KB  |  314 lines

  1. /* $Id: I3DSHObj.H 1.14 1997/06/03 00:13:32 john Exp $ */
  2. /*****************************************************************************\
  3. *                                                                             *
  4. * I3DShObj.h                                                                                *
  5. *   I3DShObject                                                               *
  6. *   I3DShPrimitive                                                            *
  7. *   I3DShPolygonList                                                          *
  8. *   I3DShPolygonArray                                                         *
  9. *   I3DShPatchList                                                            *
  10. *   I3DShPatchArray                                                           *
  11. *   I3DShFlatSurface                                                          *
  12. *                                                                             *
  13. *           Copyright (c) 1995, Ray Dream, Inc. All rights reserved.          *
  14. *                                                                             *
  15. \*****************************************************************************/
  16.  
  17. #ifndef __I3DSHOBJ__
  18. #define __I3DSHOBJ__
  19.  
  20. #ifndef __3DCOTYPE__
  21. #include "3DCoType.h"
  22. #endif
  23.  
  24.  
  25. //****** Globally Unique Ids **************************************************
  26.  
  27. DEFINE_GUID(IID_I3DShObject, 0xBDEA68A0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  28. DEFINE_GUID(IID_I3DShPrimitive, 0x5C9601A7L, 0x7CC3, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  29. DEFINE_GUID(IID_I3DShPolygonList, 0xBFBEDA80L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  30. DEFINE_GUID(IID_I3DShPolygonArray, 0xC1840A20L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  31. DEFINE_GUID(IID_I3DShPatchList, 0xBFBEDA81L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  32. DEFINE_GUID(IID_I3DShPatchArray, 0xC361A3C0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  33. DEFINE_GUID(IID_I3DShFlatSurface, 0xC546DE80L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  34. DEFINE_GUID(IID_I3DShFacetMesh, 0x11819661, 0xd86c, 0x11d0, 0x85, 0x5a, 0x0, 0xa0, 0xc9, 0xc, 0x1b, 0xf1);
  35.  
  36. //-- The following classes are available in Ray Dream Designer:
  37. DEFINE_GUID(CLSID_StandardPolygonList, 0xC756D2C0L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  38. DEFINE_GUID(CLSID_StandardPolygonArray, 0xCA395940L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  39. DEFINE_GUID(CLSID_StandardPatchList, 0x45271a20, 0xba0f, 0x11cf, 0x99, 0x09, 0x00, 0x40, 0x05, 0x22, 0xbf, 0xcc);
  40. DEFINE_GUID(CLSID_StandardPatchArray, 0xCBF56120L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  41. DEFINE_GUID(CLSID_StandardFlatSurface, 0xCDC9D300L, 0x3A02, 0x101C, 0x88, 0x5F, 0x04, 0x02, 0x1C, 0x00, 0x70, 0x02);
  42. DEFINE_GUID(CLSID_StandardFacetMesh, 0x9604bf60, 0xd86b, 0x11d0, 0x85, 0x5a, 0x0, 0xa0, 0xc9, 0xc, 0x1b, 0xf1);
  43.  
  44. struct ShadingShape;
  45. struct I3DShShader;
  46. struct I3DShScene;
  47. struct IFacetMesh;
  48.  
  49. /*****************************************************************************\
  50. *  I3DShObject                                                                *
  51. *                                                                             *
  52. *    I3DShObject contain the geometry and shading information of the objects    *
  53. *    in a scene.                                                                                                     *
  54. *    They are kept in a list in the scene (the Objects List), and can be             *
  55. *    instanciated as many times as needed in a scene.                         *                           *
  56. *                                                                             *
  57. *    There are two types of Objects: Primitives and Scenes (a Scene can be    *
  58. *    instanciated in another Scene). See I3DShPrimitive and I3DShScene.       *
  59. *                                                                             *
  60. \*****************************************************************************/
  61.  
  62. #undef  INTERFACE
  63. #define INTERFACE   I3DShObject
  64.  
  65. DECLARE_INTERFACE_(I3DShObject, IUnknown) {
  66.     // IUnknown methods
  67.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  68.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  69.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  70.  
  71.     // I3DShObject methods
  72.     //-- Naming
  73.     STDMETHOD(SetName) (THIS_ char* name) PURE;
  74.     STDMETHOD(GetName) (THIS_ char* name) PURE;
  75.     //-- Shading calls
  76.     STDMETHOD(SetSimpleShading) (THIS_ COLOR3D* color, NUM3D specularIntensity, NUM3D specularIndex, NUM3D reflection, NUM3D transparency) PURE;
  77.     STDMETHOD(SetPrimerShader) (THIS_ I3DShShader* primerShader) PURE;
  78.     STDMETHOD_(ULONG, GetUVSpaceCount) (THIS) PURE;
  79.     STDMETHOD(GetUVSpace) (THIS_ ULONG uvSpaceID, UVSpaceInfo* uvSpaceInfo) PURE;
  80.     STDMETHOD(AddShadingShape) (THIS_ ShadingShape* shadingShape, ULONG uvSpaceID) PURE;
  81.     STDMETHOD_(I3DShScene*, GetScene) (THIS) PURE;
  82.     //-- New calls API Level 9
  83.     STDMETHOD_(BOOLEAN, IsInfinite) (THIS) PURE;
  84.     };
  85.  
  86. /*****************************************************************************\
  87. *  I3DShPrimitive                                                             *
  88. *                                                                             *
  89. *    A Primitive is a simple geometric Object: sphere, polygon list, etc.     *
  90. *    Other interfaces supported: I3DShObject                                  *
  91. *                                                                             *
  92. \*****************************************************************************/
  93.  
  94. #undef  INTERFACE
  95. #define INTERFACE   I3DShPrimitive
  96.  
  97. DECLARE_INTERFACE_(I3DShPrimitive, IUnknown) {
  98.     // IUnknown methods
  99.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  100.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  101.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  102.  
  103.     // I3DShPrimitive methods
  104.     //-- Geometry calls
  105.     STDMETHOD_(BOOLEAN, IsPatchBased) (THIS) PURE;
  106.     STDMETHOD(EnumPatches) (THIS_ EnumPatchesCallback callback, void* privData) PURE;
  107.     STDMETHOD(EnumFacets) (THIS_ EnumFacetsCallback callback, void* privData) PURE;
  108.     //-- New geometry calls (API Level 6)
  109.     STDMETHOD(EnumFacetsWithConversion) (THIS_ EnumFacetsCallback callback, void* privData, BOOLEAN doPatches, NUM3D error) PURE;    // Use this call when you want facets even for patch based objects, and be able to control the error in the facettisation process
  110.     //-- New calls API Level 9
  111.   STDMETHOD(ChangedData) (THIS) PURE;    // Call this if you changed some data of the Primitive, so the Shell hear about it
  112.     STDMETHOD(GetFMesh) (THIS_ NUM3D lod, IFacetMesh*& amesh) PURE;
  113.     STDMETHOD_(BOOLEAN, IsVolumic) (THIS) PURE;    // "Volumic" primitives are special primitives such as particle systems, fog, fountain, etc.
  114.     };
  115.  
  116. //****************************** I3DShFacetMesh ***********************
  117.  
  118. DECLARE_INTERFACE_(I3DShFacetMesh, IUnknown) {
  119.     STDMETHOD(SetBBox) (const BOX3D &bbox) PURE;                         
  120.     STDMETHOD(SetNbrLOD) (short nbrLod) PURE;
  121.     STDMETHOD(SetFacetMesh) (short index,NUM3D lod,const FacetMesh &amesh) PURE;
  122.     STDMETHOD(SetUVSpaceCount) (long nbrUV) PURE;
  123.     STDMETHOD(SetUVSpace) (long index,const UVSpaceInfo &uvSpaceInfo) PURE;
  124.     };
  125.  
  126.  
  127.  
  128. /*****************************************************************************\
  129. *  I3DShPolygonList                                                           *
  130. *                                                                             *
  131. *    I3DShPolygonList is simply a bag of triangular facets.                   *
  132. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  133. *                                                                             *
  134. \*****************************************************************************/
  135.  
  136. #undef  INTERFACE
  137. #define INTERFACE   I3DShPolygonList
  138.  
  139. DECLARE_INTERFACE_(I3DShPolygonList, IUnknown) {
  140.     // IUnknown methods
  141.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  142.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  143.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  144.  
  145.     // I3DShPolygonList methods
  146.     //-- Init calls
  147.     STDMETHOD(Init) (THIS_ BOOLEAN hasNormals, BOOLEAN hasUV) PURE;
  148.     STDMETHOD(SetUVSpace0) (THIS_ VECTOR2D* minUV, VECTOR2D* maxUV) PURE; // Set UV Space #0. Use SetUVSpace if you have multiple UV Spaces
  149.     //-- Facets handling
  150.     STDMETHOD(PreAllocateFacets) (THIS_ ULONG nbFacets) PURE;        // Use this if you know in advance how many facets you will build
  151.     STDMETHOD(AddFacet) (THIS_ FACET3D* facet) PURE;
  152.     STDMETHOD_(ULONG, CountFacets) (THIS) PURE;
  153.     STDMETHOD(CalcNormals) (THIS_ NUM3D smoothAngle) PURE;                        // Use this call if you do not know how to make the normals
  154.     STDMETHOD_(FACET3D*, GetIndFacets) (THIS_ ULONG index) PURE;        // (index is 1 based)
  155.     STDMETHOD(RemoveFacet) (THIS_ ULONG index) PURE;        // (index is 1 based)
  156.     //--Init call
  157.     STDMETHOD(SetHasUVSpace) (THIS_ BOOLEAN hasUV) PURE;    // If false, will remove all previous UV Space definitions
  158.     //-- New UV Space calls (API level 6)
  159.     STDMETHOD(SetUVSpace) (THIS_ UVSpaceInfo* uvSpaceInfo) PURE; // Set an UV Space. The UV space will be added if it was not defined yet
  160.     STDMETHOD(GetUVSpace) (THIS_ ULONG uvSpaceID, UVSpaceInfo* uvSpaceInfo) PURE; // Get UV Space info
  161.     };
  162.  
  163. /*****************************************************************************\
  164. *  I3DShPolygonArray                                                          *
  165. *                                                                             *
  166. *    I3DShPolygonArray is a regular array of 3D points and normals.           *
  167. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  168. *                                                                             *
  169. \*****************************************************************************/
  170.  
  171. #undef  INTERFACE
  172. #define INTERFACE   I3DShPolygonArray
  173.  
  174. DECLARE_INTERFACE_(I3DShPolygonArray, IUnknown) {
  175.     // IUnknown methods
  176.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  177.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  178.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  179.  
  180.     // I3DShPolygonArray methods
  181.     //-- Init calls
  182.     STDMETHOD(Init) (THIS_ ULONG uCount, ULONG vCount, BOOLEAN uClosed, BOOLEAN vClosed) PURE;
  183.     //-- Geometry calls
  184.     STDMETHOD(SetVertex) (THIS_ ULONG uIndex, ULONG vIndex, VECTOR3D* vertex, VECTOR3D* normal) PURE;        // normal can be NULL
  185.     STDMETHOD(GetVertex) (THIS_ ULONG uIndex, ULONG vIndex, VECTOR3D* vertex, VECTOR3D* normal) PURE;        // normal can be NULL
  186.     //-- (u,v) calls
  187.     STDMETHOD(MeshSetU) (THIS_ ULONG  uIndex, NUM3D uValue) PURE;
  188.     STDMETHOD(MeshSetV) (THIS_ ULONG  vIndex, NUM3D vValue) PURE;
  189.     STDMETHOD(MeshGetU) (THIS_ ULONG  uIndex, NUM3D* uValue) PURE;
  190.     STDMETHOD(MeshGetV) (THIS_ ULONG  vIndex, NUM3D* vValue) PURE;
  191.     //-- Goodies
  192.     STDMETHOD(CalcUV) (THIS) PURE;                                                // Calculate for you all (u,v) values if you do not know how to make them
  193.     STDMETHOD(CalcNormals) (THIS_ BOOLEAN smooth) PURE;        // Calculate for you all normals if you do not know how to make them
  194.     };
  195.  
  196. /*****************************************************************************\
  197. *  I3DShPatchList                                                                                                                            *
  198. *                                                                             *
  199. *    I3DShPatchList is simply a bag of cubic 4 x 4 Bezier patches.            *
  200. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  201. *                                                                             *
  202. \*****************************************************************************/
  203.  
  204. #undef  INTERFACE
  205. #define INTERFACE   I3DShPatchList
  206.  
  207. DECLARE_INTERFACE_(I3DShPatchList, IUnknown) {
  208.     // IUnknown methods
  209.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  210.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  211.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  212.  
  213.     // I3DShPatchList methods
  214.     //-- Init calls
  215.     STDMETHOD(Init) (THIS_ BOOLEAN hasUV) PURE;
  216.     STDMETHOD(SetUVSpace0) (THIS_ VECTOR2D* minUV, VECTOR2D* maxUV) PURE; // Set UV Space #0. Use SetUVSpace if you have multiple UV Spaces
  217.     STDMETHOD(SetHasUVSpace) (THIS_ BOOLEAN hasUV) PURE;    // If false, will remove all previous UV Space definitions
  218.     //-- Patches handling
  219.     STDMETHOD(AddPatch) (THIS_ PATCH3D* patch) PURE;
  220.     STDMETHOD_(ULONG, CountPatches) (THIS) PURE;
  221.     //-- New UV Space calls (API level 6)
  222.     STDMETHOD(SetUVSpace) (THIS_ UVSpaceInfo* uvSpaceInfo) PURE; // Set an UV Space. The UV space will be added if it was not defined yet
  223.     STDMETHOD(GetUVSpace) (THIS_ ULONG uvSpaceID, UVSpaceInfo* uvSpaceInfo) PURE; // Get UV Space info
  224.     };
  225.  
  226. /*****************************************************************************\
  227. *  I3DShPatchArray                                                            *
  228. *                                                                             *
  229. *    I3DShPatchArray is an array of cubic 4 x 4 Bezier patches.               *
  230. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  231. *                                                                             *
  232. \*****************************************************************************/
  233.  
  234. #undef  INTERFACE
  235. #define INTERFACE   I3DShPatchArray
  236.  
  237. DECLARE_INTERFACE_(I3DShPatchArray, IUnknown) {
  238.     // IUnknown methods
  239.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  240.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  241.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  242.  
  243.     // I3DShPatchArray methods
  244.     //-- Init calls
  245.     STDMETHOD(Init) (THIS_ ULONG uCount, ULONG vCount) PURE;
  246.     //-- Geometry calls
  247.     STDMETHOD(SetPatch) (THIS_ ULONG uIndex, ULONG vIndex, PATCH3D* patch) PURE;
  248.     STDMETHOD(GetPatch) (THIS_ ULONG uIndex, ULONG vIndex, PATCH3D* patch) PURE;
  249.     //-- (u,v) calls
  250.     STDMETHOD(MeshSetU) (THIS_ ULONG uIndex, NUM3D uValue) PURE;
  251.     STDMETHOD(MeshSetV) (THIS_ ULONG vIndex, NUM3D vValue) PURE;
  252.     STDMETHOD(MeshGetU) (THIS_ ULONG uIndex, NUM3D* uValue) PURE;
  253.     STDMETHOD(MeshGetV) (THIS_ ULONG vIndex, NUM3D* vValue) PURE;
  254.     //-- Goodies
  255.     STDMETHOD(CalcUV) (THIS) PURE;                                                // Calculate for you all (u,v) values if you do not know how to make them
  256.     };
  257.  
  258. /*****************************************************************************\
  259. *  I3DShFlatSurface                                                           *
  260. *                                                                             *
  261. *    I3DShFlatSurface is a flat object made of curves and polygons            *
  262. *    Other interfaces supported: I3DShObject, I3DShPrimitive                  *
  263. *                                                                             *
  264. *        Pseudo "grammar" for building 2D curves:
  265. *        FLATSURFACE =
  266. *            BeginFlatSurface
  267. *            GROUP
  268. *            EndFlatSurface
  269. *        
  270. *        GROUP = 
  271. *            BeginGroup
  272. *            GROUP | COMPOUND | PATH                1 or more times
  273. *            EndGroup
  274. *        
  275. *        COMPOUND = 
  276. *            BeginCmpnd
  277. *            GROUP | COMPOUND | PATH                1 or more times
  278. *            EndCmpnd
  279. *        
  280. *        PATH =
  281. *            BeginPath
  282. *            LineTo | BezierTo                            1 or more times
  283. *            EndPath
  284. *                                                                             *
  285. \*****************************************************************************/
  286.  
  287. #undef  INTERFACE
  288. #define INTERFACE   I3DShFlatSurface
  289.  
  290. DECLARE_INTERFACE_(I3DShFlatSurface, IUnknown) {
  291.     // IUnknown methods
  292.   STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID* ppvObj) PURE;
  293.   STDMETHOD_(ULONG, AddRef) (THIS) PURE;
  294.   STDMETHOD_(ULONG, Release) (THIS) PURE;
  295.  
  296.     // I3DShFlatSurface methods
  297.     //-- Geometry building calls (see grammar above)
  298.     STDMETHOD(BeginFlatSurface) (THIS) PURE;        // Call this before building the surface
  299.     STDMETHOD(EndFlatSurface) (THIS) PURE;            // And this when you are done
  300.     STDMETHOD(BeginGroup) (THIS) PURE;
  301.     STDMETHOD(EndGroup) (THIS) PURE;
  302.     STDMETHOD(BeginCmpnd) (THIS) PURE;                    // Use compounds to make holes
  303.     STDMETHOD(EndCmpnd) (THIS) PURE;
  304.     STDMETHOD(BeginPath) (THIS_ VECTOR2D* firstPoint) PURE;
  305.     STDMETHOD(LineTo) (THIS_ VECTOR2D* secondPoint) PURE;
  306.     STDMETHOD(BezierTo) (THIS_ VECTOR2D* secondPoint, VECTOR2D* thirdPoint, VECTOR2D* fourthPoint) PURE;
  307.     STDMETHOD(EndPath) (THIS) PURE;
  308.     };
  309.  
  310.  
  311.  
  312. #endif
  313.  
  314.